import json

import unittest

from parameterized import parameterized

data_from_jason = []
with open('../test.json', encoding='UTF-8')as j:
    received = json.load(j)[2:]
for a in received:
    lst = []
    for b in a.values():
        lst.append(b)
    data_from_jason.append(lst)


def log(name, pwd):
    if name == 'admin' and pwd == '123456':
        return '登录成功'
    else:
        return '登录失败'


class Testjson(unittest.TestCase):

    @parameterized.expand(data_from_jason)
    def test_method(self, disc, name, pwd, expect):
        self.assertEqual(expect, log(name, pwd))
